<?php

use yii\helpers\Html;
use yii\grid\GridView;
use yii\widgets\ActiveForm;
use yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $searchModel backend\models\ArticleSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = '文章列表';
$this->params['breadcrumbs'][] = $this->title;
?>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper" style="width: 100%;margin-left: 0;">
    <!-- Main content -->
    <section class="content">
        <div class="row">
            <!-- right column -->
            <div class="col-md-12">
                <!-- general form elements disabled -->
                <div class="box">
                    <div class="box-body">
                        <?php
                        $form = ActiveForm::begin([
                            'method' => 'get',
                            'action' => 'index',
                            'options' => ['class' => 'form-horizontal'],
                        ]);
                        ?>
                        <div class="col-md-2" style="margin-right: 10px;">
                            <?= $form->field($searchModel, 'username')->textInput(['maxlength' => true, 'placeholder' => '昵称'])->label(false); ?>
                        </div>
                        <div class="col-md-2">
                            <?= Html::submitButton('搜索', ['class' => 'btn btn-primary', 'style' => 'width:60px']); ?>
                            <?= Html::a('重置', Url::to(['user/index']), ['class' => 'btn btn-primary']); ActiveForm::end();?>
                        </div>
                    </div>
                    <!-- /.box-body -->
                </div>
                <!-- /.box -->
            </div>
            <!--/.col (right) -->
        </div>
        <div class="row">
            <div class="col-md-12">
                <div class="box">
                    <div class="box-body">
                        <table id="example1" class="table table-bordered table-striped">
                            <tbody>
                            <?= GridView::widget([
                                'dataProvider' => $dataProvider,
                                'layout' => '{items}<div class="text-right tooltip-demo">{pager}</div>',
                                // ......
                                'columns' => [
                                    ['class' => 'yii\grid\SerialColumn', 'header' => '序号'],//序列号从1开始
                                    'id',
                                    'username',
                                ],
                                'pager' => [
                                    //'options'=>['class'=>'hidden']//关闭自带分页
                                    'firstPageLabel' => "首页",
                                    'prevPageLabel' => '上一页',
                                    'nextPageLabel' => '下一页',
                                    'lastPageLabel' => '末页',
                                ],
                            ]);
                            ?>
                            </tbody>
                        </table>
                    </div>
                    <!-- /.box-body -->
                </div>
                <!-- /.box -->
            </div>
            <!-- /.col -->
        </div>
        <!-- /.row -->
    </section>
    <!-- /.content -->
</div>
<!-- /.content-wrapper -->
